package cn.dw.web.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.dw.domain.picCategory;
import cn.dw.service.PicCategoryService;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

public class PicCategoryAction {

	private PicCategoryService pcs;
	
	public JSONObject result;
	
	public String getpicCategory(){
		
		List<picCategory> picCategories = new ArrayList<picCategory>();
		picCategories = pcs.getAll();
		
		Map<String, Object> map = new HashMap<String, Object>();
		
		map.put("list", picCategories);
		
		JsonConfig jsonConfig = new JsonConfig();  //建立配置文件
        jsonConfig.setIgnoreDefaultExcludes(false);  //设置默认忽略
        jsonConfig.setExcludes(new String[]{"picInfos"}); 
		
		JSONObject jo = JSONObject.fromObject(map,jsonConfig);
		
		this.result = jo;
		
		return "picCategory";
	}

	public PicCategoryService getPcs() {
		return pcs;
	}

	public void setPcs(PicCategoryService pcs) {
		this.pcs = pcs;
	}
	
	
	
}
